package com.mark.mall.admin.platform.controller;


import com.github.pagehelper.PageInfo;
import com.mark.mall.admin.platform.dto.OrderDTO;
import com.mark.mall.admin.platform.dto.OrderDetailDTO;
import com.mark.mall.admin.platform.dto.PageParamDTO;
import com.mark.mall.common.resultBean.R;
import com.mark.mall.admin.platform.service.OrderService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 销售单表 前端控制器
 * </p>
 *
 * @author admin
 * @since 2021-02-28
 */
@RestController
@RequestMapping("/admin/order")
@Api(tags = "后台销售单模块")
@RequiredArgsConstructor
public class OrderController {
    private final OrderService orderService;

    @ApiOperation(value = "获取订单列表(只能根据orderNo进行查询)", httpMethod = "GET")
    @GetMapping("list")
    public R<PageInfo<OrderDTO>> orderPageInfo(PageParamDTO param, String orderNo) {
        return orderService.orderPageInfo(param, orderNo);
    }

    @ApiOperation(value = "删除订单", httpMethod = "POST")
    @PostMapping("del")
    public R<Boolean> delOrder(String id) {
        return orderService.delOrder(id);
    }

    @ApiOperation(value = "获取订单详情", httpMethod = "GET")
    @GetMapping("detail")
    public R<OrderDetailDTO> orderDetail(String orderId) {
        return orderService.detail(orderId);
    }
}
